package com.yaoxuguang.concurrence.ThreadLocal.variable_isolation;

/**
 * @author yaoxuguang
 * @Title: yao-interview
 * @Package com.yaoxuguang.concurrence.ThreadLocal.variable_isolation
 * @Description: 验证线程变量的隔离性
 * @date 2018年12月24日14:47
 */
public class Run {
    public static void main(String[] args) {
        try {
            ThreadA a = new ThreadA();
            ThreadB b = new ThreadB();
            a.start();
            b.start();

            for (int i = 0; i < 100; i++) {
                Tools.threadLocal.set("Main Thread "+(i+1));
                System.out.println("main get value="+Tools.threadLocal.get());
                Thread.sleep(200);
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
